
<script type="text/javascript">
	function submit()
	{
		$("#frmMenu").submit();
		}
 </script>
<form method="post"
	action="<?php echo $this->url(array("action"=>"index")) ?>" name="form"
	id="frmMenu">
	<!-- Filter Panel -->
	<div id="filter-panel" class="ui-corner-all ui-widget-content">
		<span>Filter by status:</span> <label for="filter1">Actived</label> <input
			type="checkbox" name="filter1" value="" id="filter1" /> <label
			for="filter2">Pending</label> <input type="checkbox" name="filter1"
			value="" id="filter2" /> <label for="filter3">Scheduled</label> <input
			type="checkbox" name="filter1" value="" id="filter3" /> <label
			for="filter4">UnActived</label> <input type="checkbox" name="filter1"
			value="" id="filter4" />
	</div>
	<!-- End Filter Panel -->

	<!-- Sorting Panel -->
	<div id="sort-panel">
		<span class="bold">Sort By:</span> <select name="sorting">
			<option value="1">Choose a type</option>
			<option value="1">Name</option>
			<option value="2">Status</option>
		</select>
	</div>
	<!-- End Sorting Panel -->
	<!-- Sorting Panel -->
                   <?php
																			
																			$mainMenu = new Default_Model_DbTable_Menu ();
																			$allMenu = $mainMenu->getMenuByParent ( 0, 1 );
																			?>
                <div id="sort-panel">
		<span class="bold">Sort With Main Menu:</span> <select
			name="sort-main-menu" onchange="submit();">
			<option value="-1">Choose menu</option>
                    	<?php
																					foreach ( $allMenu as $aM ) :
																						?>
                    	<option value="<?php echo $aM["ID"]?>"><?php echo $aM["MENU_NAME"]?></option>
                    	<?php endforeach;?>
                    </select>
	</div>
	<!-- End Sorting Panel -->
	<!-- Sorting Panel -->
	<?php if(sizeof($this->allCate1) <= 0){?>
	<div id="sort-panel">
		<span class="bold">Sort With Menu Lvl 2:</span> <select name="menu-lvl-2" onchange="submit();">
					<option value="-1">Main Menu First</option>
                    <?php
																				foreach ( $this->allCat as $m ) :
																					?>
                    	<option value="<?php echo $m["ID"]?>"><?php echo $m["MENU_NAME"]?></option>
                    	<?php endforeach;?>
                    </select>
	</div>
	<?php }?>
	<!-- End Sorting Panel -->

	<div class="clear"></div>
	<!-- Clear floatting -->

	<!-- New Page Button -->
	<div style="margin: 10px 0px 20px 10px">
		<a href="<?php echo $this->url(array("action"=>"add"))?>"
			class="submit button large ui-corner-all">Thêm Mới</a>
	</div>
	<!-- END New Page Button -->

	<table class="list-table">
		<thead>
			<tr>
				<th>ID</th>
				<th>Tên Danh Mục</th>
				<th>Danh Mục Cha</th>
				<th>Mô Tả</th>
				<th>Hình Ảnh</th>
				<th>Controller</th>
				<th>Trạng Thái</th>
				<th colspan="4">Chỉnh Sửa</th>
			</tr>
		</thead>
		<tbody>
                <?php foreach ($this->allCat as $ca){?>
                	<tr>
				<td><?php echo $ca["ID"]?></td>
				<td><?php echo "<a href=".$this->url(array("action"=>"edit","id"=>$ca["ID"])).">".$ca["MENU_NAME"]."</a>";?></td>
				<td><?php echo $ca["MENU_NAME"]=$ca["PARENT_ID"]?></td>
				<td><?php echo $ca["MENU_DESCRIPTION"]?></td>
				<td><img height="100" width="100" src="<?php echo $ca["IMG"]?>" /></td>
				<td><?php echo $ca["CONTROLLER"]?></td>
                        <?php if($ca["STATUS"] == 1){?>
                        <td><a
					href="<?php echo $this->url(array("action"=>"active","id"=>$ca["ID"]))?>"><span
						class="button submit medium green-back fixed-width-100 ui-corner-all">Actived</span></a></td>
                        <?php }else{?>
                        <td><a
					href="<?php echo $this->url(array("action"=>"active","id"=>$ca["ID"]))?>"><span
						class="button submit medium green-back fixed-width-100 ui-corner-all">No
							Actived</span></a></td>
                        <?php }?>
                        <td><a
					href="<?php echo $this->url(array("action"=>"edit","id"=>$ca["ID"]))?>"
					class="edit-record">Chỉnh Sửa</a></td>
				<td><a
					href="<?php echo $this->url(array("action"=>"del","id"=>$ca["ID"]))?>"><img
						src="<?php echo $this->baseUrl()?>/public/images/icons/delete.png">Xóa</a></td>
			</tr>
                    <?php }?>
                </tbody>
	</table>
</form>
<hr />
<!-- Divider -->

<!-- Pagination -->
<div id="pagination">
            	<?php echo $this->paginationControl($this->allCat,"Sliding","pagination.phtml")?>
           </div>
<!-- End Pagination -->